package com.lxd.bank.mapper;

import com.lxd.bank.pojo.BankMqLog;
import com.lxd.bank.pojo.OrderMqLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BankMapper {

    @Select("select * from mq_log where tid = #{id}")
    List<BankMqLog> selectMqLogByTid(Integer id);

    @Update("update account set balance=balance - #{money} where user_id = #{userId}")
    void updateAccount(OrderMqLog msg);

    @Insert("insert into mq_log(money,tid,user_id) values(#{money},#{id},#{userId})")
    void insertMqLog(OrderMqLog msg);
}
